<?php
	
namespace App\Http\Controllers;

use DB;
use Laravel\Lumen\Routing\Controller;
use Illuminate\Http\Request;

class CouponController extends BaseController{

    public function index($code){
        $couponResult = DB::table('coupon')->join('seller','seller.id','=','coupon.seller_id')
                                            ->join('admin','admin.id','=','seller.admin_id')
                                            ->select('coupon.*','seller_id as seller_id','seller.name as seller_name')
                                            ->where('admin.code','=',$code)
                                            ->paginate(12)
                                            ->toJson();
        $couponResult = json_decode($couponResult);                                                                        
        return $this::jsonResponse(false,$couponResult);
    }    
}   